<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="正则表达式,Linux命令," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sed 命令是利用 script 来处理文本文件。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sed 可依照 script 的指令来处理、编辑文本文件。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;">
<meta name="keywords" content="正则表达式,Linux命令">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux 命令- sed">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/70. Linux 命令- sed/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sed 命令是利用 script 来处理文本文件。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sed 可依照 script 的指令来处理、编辑文本文件。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-09-01T08:38:16.185Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Linux 命令- sed">
<meta name="twitter:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sed 命令是利用 script 来处理文本文件。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sed 可依照 script 的指令来处理、编辑文本文件。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/70. Linux 命令- sed/"/>





  <title>Linux 命令- sed | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/70. Linux 命令- sed/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Linux 命令- sed</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T01:57:34+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sed 命令是利用 script 来处理文本文件。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sed 可依照 script 的指令来处理、编辑文本文件。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sed 主要用来自动编辑一个或多个文件；简化对文件的反复操作；编写转换程序等。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sed 可以实现 grep 的大部分功能，而且还可以查找替换。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sed 跟 grep 一样，不识别 + 、| 、｛｝、 （）等符号，需要借助脱义符号 、 或者使用选项 -r</p>
<h2 id="1-命令语法"><a href="#1-命令语法" class="headerlink" title="1. 命令语法"></a>1. 命令语法</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sed [-hnV] [-e&lt;script&gt;] [-f&lt;script文件&gt;] [文本文件]</div></pre></td></tr></table></figure>
<h2 id="2-命令参数"><a href="#2-命令参数" class="headerlink" title="2. 命令参数"></a>2. 命令参数</h2><ul>
<li>-e <code>&lt;script&gt;或--expression=&lt;script&gt;</code> 以选项中指定的script来处理输入的文本文件。</li>
<li>-f <script文件>或–file=<script文件> 以选项中指定的script文件来处理输入的文本文件。</script文件></script文件></li>
<li>-h 或–help 显示帮助。</li>
<li>-n 或–quiet或–silent 仅显示script处理后的结果。</li>
<li>-V 或–version 显示版本信息。</li>
</ul>
<h2 id="3-命令动作"><a href="#3-命令动作" class="headerlink" title="3. 命令动作"></a>3. 命令动作</h2><ul>
<li>a ：新增， a 的后面可以接字串，而这些字串会在新的一行出现(目前的下一行)～</li>
<li>c ：取代， c 的后面可以接字串，这些字串可以取代 n1,n2 之间的行！</li>
<li>d ：删除，因为是删除啊，所以 d 后面通常不接任何咚咚；</li>
<li>i ：插入， i 的后面可以接字串，而这些字串会在新的一行出现(目前的上一行)；</li>
<li>p ：列印，亦即将某个选择的数据印出。通常 p 会与参数 sed -n 一起运行～</li>
<li>s ：取代，可以直接进行取代的工作哩！通常这个 s 的动作可以搭配正规表示法！例如 1,20s/old/new/g 就是啦！</li>
</ul>
<h2 id="4-使用实例"><a href="#4-使用实例" class="headerlink" title="4.使用实例"></a>4.使用实例</h2><h3 id="实例1：在-testfile-文件的第四行后添加一行，并将结果输出到标准输出"><a href="#实例1：在-testfile-文件的第四行后添加一行，并将结果输出到标准输出" class="headerlink" title="实例1：在 testfile 文件的第四行后添加一行，并将结果输出到标准输出"></a>实例1：在 testfile 文件的第四行后添加一行，并将结果输出到标准输出</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sed -e 4a \newLine testfile</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">$ cat testfile </div><div class="line">HELLO LINUX!  </div><div class="line">Linux is a free unix-type opterating system.  </div><div class="line">This is a linux testfile!  </div><div class="line">Linux <span class="built_in">test</span> </div><div class="line">$ sed -e 4a\newline testfile </div><div class="line">HELLO LINUX!   </div><div class="line">Linux is a free unix-type opterating system.  </div><div class="line">This is a linux testfile!  </div><div class="line">Linux <span class="built_in">test</span>  </div><div class="line">newline</div></pre></td></tr></table></figure>
<h2 id="实例2：将-etc-passwd-的内容列出并且列印行号，同时将第2-5行删除"><a href="#实例2：将-etc-passwd-的内容列出并且列印行号，同时将第2-5行删除" class="headerlink" title="实例2：将 /etc/passwd 的内容列出并且列印行号，同时将第2-5行删除"></a>实例2：将 /etc/passwd 的内容列出并且列印行号，同时将第2-5行删除</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed <span class="string">'2,5d'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># nl /etc/passwd|sed '2,5d'</span></div><div class="line">     1  root:x:0:0:root:/root:/bin/bash</div><div class="line">     6  sync:x:5:0:sync:/sbin:/bin/sync</div><div class="line">     7  shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown</div><div class="line">     8  halt:x:7:0:halt:/sbin:/sbin/halt</div><div class="line">     9  mail:x:8:12:mail:/var/spool/mail:/sbin/nologin</div><div class="line">    10  operator:x:11:0:operator:/root:/sbin/nologin</div><div class="line">    11  games:x:12:100:games:/usr/games:/sbin/nologin</div><div class="line">    12  ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin</div><div class="line">    13  nobody:x:99:99:Nobody:/:/sbin/nologin</div><div class="line">    14  systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin</div><div class="line">    15  systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin</div><div class="line">    16  dbus:x:81:81:System message bus:/:/sbin/nologin</div><div class="line">    17  polkitd:x:998:996:User <span class="keyword">for</span> polkitd:/:/sbin/nologin</div><div class="line">    18  tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin</div><div class="line">    19  postfix:x:89:89::/var/spool/postfix:/sbin/nologin</div><div class="line">    20  sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin</div><div class="line">    21  chrony:x:997:995::/var/lib/chrony:/sbin/nologin</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;以行为单位的删除，sed 的动作为 ‘2,5d’，那个 d 就是删除。因为 2-5 行给删除了，所以显示的数据就没有 2-5 行。另外，注意一下，原本应该是要下达 -e 才对，没有 -e 也可以。同时也要注意的是，sed 后面接的动作务必以 ‘’单引号括住。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;只要删除第2行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed <span class="string">'2d'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;要删除第3到最后一行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd |sed <span class="string">'3,$d'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在第2行后，第3行上加上 ‘drink tea’ 字样</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed <span class="string">'2a drink tea'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果要加再第2行前</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed <span class="string">'2i drink tea'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果要在第2行后面加入两行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed <span class="string">'2a drink tea \</span></div><div class="line"><span class="string">&gt; drink beer'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;每一行之间都必须要以反斜杠（\）来进行新行的添加</p>
<h3 id="实例3：将第2-5行内容取代成为‘2-5-number’"><a href="#实例3：将第2-5行内容取代成为‘2-5-number’" class="headerlink" title="实例3：将第2-5行内容取代成为‘2-5 number’"></a>实例3：将第2-5行内容取代成为‘2-5 number’</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed <span class="string">'2,5c 2-5 number'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># nl /etc/passwd | sed '2,5c 2-5 number'</span></div><div class="line">     1  root:x:0:0:root:/root:/bin/bash</div><div class="line">2-5 number</div><div class="line">     6  sync:x:5:0:sync:/sbin:/bin/sync</div><div class="line">     7  shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown</div><div class="line">     8  halt:x:7:0:halt:/sbin:/sbin/halt</div><div class="line">     9  mail:x:8:12:mail:/var/spool/mail:/sbin/nologin</div><div class="line">    10  operator:x:11:0:operator:/root:/sbin/nologin</div><div class="line">    11  games:x:12:100:games:/usr/games:/sbin/nologin</div><div class="line">    12  ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin</div><div class="line">    13  nobody:x:99:99:Nobody:/:/sbin/nologin</div><div class="line">    14  systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin</div><div class="line">    15  systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin</div><div class="line">    16  dbus:x:81:81:System message bus:/:/sbin/nologin</div><div class="line">    17  polkitd:x:998:996:User <span class="keyword">for</span> polkitd:/:/sbin/nologin</div><div class="line">    18  tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin</div><div class="line">    19  postfix:x:89:89::/var/spool/postfix:/sbin/nologin</div><div class="line">    20  sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin</div><div class="line">    21  chrony:x:997:995::/var/lib/chrony:/sbin/nologin</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;以行为单位的替换与显示，通过这个方法就能够将数据整行取代了。</p>
<h3 id="实例4：仅列出-etc-passwd-文件内的5-7-行"><a href="#实例4：仅列出-etc-passwd-文件内的5-7-行" class="headerlink" title="实例4：仅列出 /etc/passwd 文件内的5-7 行"></a>实例4：仅列出 /etc/passwd 文件内的5-7 行</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd |sed -n <span class="string">'5,7p'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># nl /etc/passwd | sed -n '5,7p'</span></div><div class="line">     5  lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin</div><div class="line">     6  sync:x:5:0:sync:/sbin:/bin/sync</div><div class="line">     7  shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong><br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果 root 找到，处理输出所有行，还回输出匹配行。<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;使用 -n 的时候将只打印包含模版的行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># nl /etc/passwd | sed -n '/root/p'</span></div><div class="line">     1  root:x:0:0:root:/root:/bin/bash</div><div class="line">    10  operator:x:11:0:operator:/root:/sbin/nologin</div></pre></td></tr></table></figure>
<h3 id="实例5：删除-etc-paawd-所有包含-root-的行，其他行输出"><a href="#实例5：删除-etc-paawd-所有包含-root-的行，其他行输出" class="headerlink" title="实例5：删除 /etc/paawd 所有包含 root 的行，其他行输出"></a>实例5：删除 /etc/paawd 所有包含 root 的行，其他行输出</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed <span class="string">'/root/d'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># nl /etc/passwd | sed '/root/d'</span></div><div class="line">     2  bin:x:1:1:bin:/bin:/sbin/nologin</div><div class="line">     3  daemon:x:2:2:daemon:/sbin:/sbin/nologin</div><div class="line">     4  adm:x:3:4:adm:/var/adm:/sbin/nologin</div><div class="line">     5  lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin</div><div class="line">     6  sync:x:5:0:sync:/sbin:/bin/sync</div><div class="line">     7  shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown</div><div class="line">     8  halt:x:7:0:halt:/sbin:/sbin/halt</div><div class="line">     9  mail:x:8:12:mail:/var/spool/mail:/sbin/nologin</div><div class="line">    11  games:x:12:100:games:/usr/games:/sbin/nologin</div><div class="line">    12  ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin</div><div class="line">    13  nobody:x:99:99:Nobody:/:/sbin/nologin</div><div class="line">    14  systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin</div><div class="line">    15  systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin</div><div class="line">    16  dbus:x:81:81:System message bus:/:/sbin/nologin</div><div class="line">    17  polkitd:x:998:996:User <span class="keyword">for</span> polkitd:/:/sbin/nologin</div><div class="line">    18  tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin</div><div class="line">    19  postfix:x:89:89::/var/spool/postfix:/sbin/nologin</div><div class="line">    20  sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin</div><div class="line">    21  chrony:x:997:995::/var/lib/chrony:/sbin/nologin</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;数据的搜寻并删除</p>
<h3 id="实例6：搜索-etc-passwd-找到-root-对应的行，执行后面花括号中的命令，每个命令之间用分号分割，并把bash替换为blueshell，在输出这行"><a href="#实例6：搜索-etc-passwd-找到-root-对应的行，执行后面花括号中的命令，每个命令之间用分号分割，并把bash替换为blueshell，在输出这行" class="headerlink" title="实例6：搜索 /etc/passwd 找到 root 对应的行，执行后面花括号中的命令，每个命令之间用分号分割，并把bash替换为blueshell，在输出这行"></a>实例6：搜索 /etc/passwd 找到 root 对应的行，执行后面花括号中的命令，每个命令之间用分号分割，并把bash替换为blueshell，在输出这行</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed -n <span class="string">'/bash/ &#123;s/bash/blueshell/;p;q&#125;'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># nl /etc/passwd | sed -n '/bash/ &#123;s/bash/blueshell/;p;q&#125;'</span></div><div class="line">     1  root:x:0:0:root:/root:/bin/blueshell</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;数据的搜寻并执行命令，最后的q是退出</p>
<h3 id="实例7：查找-etc-passwd-内-root-的行，并把-root-替换为-shell"><a href="#实例7：查找-etc-passwd-内-root-的行，并把-root-替换为-shell" class="headerlink" title="实例7：查找 /etc/passwd 内 root 的行，并把 root 替换为 shell"></a>实例7：查找 /etc/passwd 内 root 的行，并把 root 替换为 shell</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">sed <span class="string">'s/root/shell/g'</span> /etc/passwd</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># sed 's/root/shell/g' /etc/passwd</span></div><div class="line">shell:x:0:0:shell:/shell:/bin/bash</div><div class="line">bin:x:1:1:bin:/bin:/sbin/nologin</div><div class="line">daemon:x:2:2:daemon:/sbin:/sbin/nologin</div><div class="line">adm:x:3:4:adm:/var/adm:/sbin/nologin</div><div class="line">lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin</div><div class="line">sync:x:5:0:sync:/sbin:/bin/sync</div><div class="line">shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown</div><div class="line">halt:x:7:0:halt:/sbin:/sbin/halt</div><div class="line">mail:x:8:12:mail:/var/spool/mail:/sbin/nologin</div><div class="line">operator:x:11:0:operator:/shell:/sbin/nologin</div><div class="line">games:x:12:100:games:/usr/games:/sbin/nologin</div><div class="line">ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin</div><div class="line">nobody:x:99:99:Nobody:/:/sbin/nologin</div><div class="line">systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin</div><div class="line">systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin</div><div class="line">dbus:x:81:81:System message bus:/:/sbin/nologin</div><div class="line">polkitd:x:998:996:User <span class="keyword">for</span> polkitd:/:/sbin/nologin</div><div class="line">tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin</div><div class="line">postfix:x:89:89::/var/spool/postfix:/sbin/nologin</div><div class="line">sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin</div><div class="line">chrony:x:997:995::/var/lib/chrony:/sbin/nologin</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;数据的搜寻并替换，s 就是替换的意思，g 为全局替换，否则只替换一次。</p>
<h3 id="实例8：使用-ifconfig-查看ip地址，并提取出ip地址"><a href="#实例8：使用-ifconfig-查看ip地址，并提取出ip地址" class="headerlink" title="实例8：使用 ifconfig 查看ip地址，并提取出ip地址"></a>实例8：使用 ifconfig 查看ip地址，并提取出ip地址</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;先使用 ifconfig 命令查询eth0网卡ip</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># ifconfig eth0</span></div><div class="line">eth0      Link encap:Ethernet  HWaddr 00:0C:29:4D:9F:F7  </div><div class="line">          inet addr:192.168.0.73  Bcast:192.168.0.255  Mask:255.255.255.0</div><div class="line">          inet6 addr: fe80::20c:29ff:fe4d:9ff7/64 Scope:Link</div><div class="line">          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1</div><div class="line">          RX packets:41 errors:0 dropped:0 overruns:0 frame:0</div><div class="line">          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0</div><div class="line">          collisions:0 txqueuelen:1000 </div><div class="line">          RX bytes:4525 (4.4 KiB)  TX bytes:5868 (5.7 KiB)</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ifconfig eth0 | grep <span class="string">'inet addr'</span> | sed <span class="string">'s/^.*addr://g'</span> | sed <span class="string">'s/Bcast.*$//g'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">ifconfig eth0 | grep <span class="string">'inet addr'</span> | sed <span class="string">'s/^.*addr://g'</span> | sed <span class="string">'s/Bcast.*$//g'</span></div><div class="line">192.168.0.73</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;数据的搜寻并替换，先观察原始信息，利用 ficonfig 查询 eth0 网卡 ip，再用 sed 命令将 ip 前面的部分删除（就是把前面的部分替换为空），接下来是删除后续的部分（把后续部分替换为空）</p>
<h3 id="实例9：删除-etc-passwd-第3行到末尾的数据，并把bash-替换为-blueshell"><a href="#实例9：删除-etc-passwd-第3行到末尾的数据，并把bash-替换为-blueshell" class="headerlink" title="实例9：删除 /etc/passwd 第3行到末尾的数据，并把bash 替换为 blueshell"></a>实例9：删除 /etc/passwd 第3行到末尾的数据，并把bash 替换为 blueshell</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nl /etc/passwd | sed -e <span class="string">'3,$d'</span> -e <span class="string">'s/bash/blueshell/g'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># nl /etc/passwd | sed -e '3,$d' -e 's/bash/blueshell/g'</span></div><div class="line"></div><div class="line">     1  root:x:0:0:root:/root:/bin/blueshell</div><div class="line">     2  bin:x:1:1:bin:/bin:/sbin/nologin</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;多点编辑，-e 表示多点编辑，第一个编辑命令删除 /etc/passwd 第三行到末行的数据，第二条命令搜索 bash 替换为 blueshell</p>
<h3 id="实例10：直接修改文件内容（危险动作）"><a href="#实例10：直接修改文件内容（危险动作）" class="headerlink" title="实例10：直接修改文件内容（危险动作）"></a>实例10：直接修改文件内容（危险动作）</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sed 可以直接修改文件的内容，不必使用管道命令或数据流重定向。不过，由于这个动作会直接修改到原始的文件，所以千万不要随便拿系统配置文件来测试!</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;先用 cp 命令拷贝一份/etc/passwd 文件为 1.txt</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cp /etc/passwd 1.txt</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;删除所有非数字</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># sed -i 's/[^0-9]//g' 1.txt</span></div><div class="line">[root@localhost ~]<span class="comment"># cat 1.txt</span></div><div class="line">00</div><div class="line">11</div><div class="line">22</div><div class="line">34</div><div class="line">47</div><div class="line">50</div><div class="line">60</div><div class="line">70</div><div class="line">812</div><div class="line">110</div><div class="line">12100</div><div class="line">1450</div><div class="line">9999</div><div class="line">999997</div><div class="line">192192</div><div class="line">8181</div><div class="line">998996</div><div class="line">5959</div><div class="line">8989</div><div class="line">7474</div><div class="line">997995</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sed 的 -i 选项可以直接修改文件内容，这功能非常有帮助！举例来说，如果有一个100万行的文件，要在第100行加某些文字，此时使用 vim 可能会疯掉！因为文件太大了！就利用 sed ，通过 sed 直接修改、取代的功能，甚至不用使用 vim 去修订。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/正则表达式/" rel="tag"># 正则表达式</a>
          
            <a href="/tags/Linux命令/" rel="tag"># Linux命令</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/2. Linux 命令/40. Linux 命令- cal/" rel="next" title="Linux 命令- cal">
                <i class="fa fa-chevron-left"></i> Linux 命令- cal
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/2. Linux 命令/31. group 文件详解/" rel="prev" title="/etc/group 文件详解">
                /etc/group 文件详解 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-命令语法"><span class="nav-number">1.</span> <span class="nav-text">1. 命令语法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-命令参数"><span class="nav-number">2.</span> <span class="nav-text">2. 命令参数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-命令动作"><span class="nav-number">3.</span> <span class="nav-text">3. 命令动作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-使用实例"><span class="nav-number">4.</span> <span class="nav-text">4.使用实例</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#实例1：在-testfile-文件的第四行后添加一行，并将结果输出到标准输出"><span class="nav-number">4.1.</span> <span class="nav-text">实例1：在 testfile 文件的第四行后添加一行，并将结果输出到标准输出</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#实例2：将-etc-passwd-的内容列出并且列印行号，同时将第2-5行删除"><span class="nav-number">5.</span> <span class="nav-text">实例2：将 /etc/passwd 的内容列出并且列印行号，同时将第2-5行删除</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#实例3：将第2-5行内容取代成为‘2-5-number’"><span class="nav-number">5.1.</span> <span class="nav-text">实例3：将第2-5行内容取代成为‘2-5 number’</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例4：仅列出-etc-passwd-文件内的5-7-行"><span class="nav-number">5.2.</span> <span class="nav-text">实例4：仅列出 /etc/passwd 文件内的5-7 行</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例5：删除-etc-paawd-所有包含-root-的行，其他行输出"><span class="nav-number">5.3.</span> <span class="nav-text">实例5：删除 /etc/paawd 所有包含 root 的行，其他行输出</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例6：搜索-etc-passwd-找到-root-对应的行，执行后面花括号中的命令，每个命令之间用分号分割，并把bash替换为blueshell，在输出这行"><span class="nav-number">5.4.</span> <span class="nav-text">实例6：搜索 /etc/passwd 找到 root 对应的行，执行后面花括号中的命令，每个命令之间用分号分割，并把bash替换为blueshell，在输出这行</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例7：查找-etc-passwd-内-root-的行，并把-root-替换为-shell"><span class="nav-number">5.5.</span> <span class="nav-text">实例7：查找 /etc/passwd 内 root 的行，并把 root 替换为 shell</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例8：使用-ifconfig-查看ip地址，并提取出ip地址"><span class="nav-number">5.6.</span> <span class="nav-text">实例8：使用 ifconfig 查看ip地址，并提取出ip地址</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例9：删除-etc-passwd-第3行到末尾的数据，并把bash-替换为-blueshell"><span class="nav-number">5.7.</span> <span class="nav-text">实例9：删除 /etc/passwd 第3行到末尾的数据，并把bash 替换为 blueshell</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例10：直接修改文件内容（危险动作）"><span class="nav-number">5.8.</span> <span class="nav-text">实例10：直接修改文件内容（危险动作）</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
